package com.csyf.manager.config;

import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

@Configuration
public class SchedulerListener implements ApplicationListener<ContextRefreshedEvent> {


    @Autowired
    private SchedulerCenterConifg scheduleJobs;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) { 
        try {
            scheduleJobs.scheduleJobs();
        } catch (SchedulerException e) {
            e.printStackTrace(); 
        }
     } 

}